<?php

    // 连接数据库
    $conn = mysqli_connect('b-y6vghyumfx2mec.bch.rds.gz.baidubce.com:3306' , 'b_y6vghyumfx2mec' , 'wza010826' , 'b_y6vghyumfx2mec') ;

    if(!$conn) {
        die('数据库连接失败') ;
    }


    
    $sql = "SELECT*FROM banner ORDER BY img_id asc" ;
    $a = mysqli_query($conn , $sql) ;
    
    // $data = mysqli_fetch_array($a) ;

    $list = [] ;

    while($data = mysqli_fetch_array($a)) {
    array_push($list , $data) ;
    } 

    if($list) {
        $res['status'] = true ;
        $res['msg'] = '请求成功' ;
        $res['list'] = $list ;

    } else {
        $res['status'] = false ;
        $res['msg'] = '数据库错误' ;
    }

    

    echo(json_encode($res)) ;
